using System;
using System.Collections.Generic;
using System.Text;
using System.Reflection;

namespace AAM.BIZ
{
    public class BizObject : IBizObject
    {

        private ObjectID id;

        public BizObject(ObjectID id)
        {
            Tools.Util.CheckObject(id);
            this.id = id;
        }

        public BizObject(ObjectType type, object[] values)
        {
            id = new ObjectID(type, values);
        }

        public ObjectID ID { get { return id; } }
        public ObjectType Type { get { return id.Type; } }
        public string TypeName { get { return id.Type.Name; } }

        public override bool Equals(object obj)
        {
            if (!(obj is IBizObject)) return false;
            IBizObject other = (IBizObject)obj;
            return id.Equals(other.ID);
        }

        public override int GetHashCode()
        {
            return id.GetHashCode();
        }

        public override string ToString()
        {
            return id.ToString();
        }

    }
}
